import type { BaseEntity, ID, PageQuery, PageResult } from '#/api/common';

import { requestClient } from '#/api/request';

export interface AppUser extends BaseEntity {
  userId: string;
  nickname: string;
  phoneNumber: string;
  status: string;
  gender: string;
  avatar: string;
  loginIp: string;
  loginDate: string;
}

const baseUrl = `/ur_biz/app_user`;

/** 用户分页列表 */
export function listUser(query?: PageQuery) {
  return requestClient.get<PageResult<AppUser>>(`${baseUrl}/list`, {
    params: query,
  });
}

/** 查询用户详细 */
export function getUser(userId: ID) {
  return requestClient.get<AppUser>(`${baseUrl}/${userId}`);
}

/** 用户状态修改 */
export function changeStatus(id: string, status: string) {
  return requestClient.post(`${baseUrl}/edit_status`, {
    id,
    status,
  });
}
